#include "GridSample.h"
#include "imgui.h"
#include "GLFW/glfw3.h"
#include "glad/glad.h"
#include "glm/gtx/transform.hpp"
GridSample::GridSample() {
	grid = new Grid();
	y = 1.0f;
	z = 2.0f;
}

GridSample::~GridSample() {
	delete grid;
}

void GridSample::Init() {
	grid->Init();
}

void GridSample::Update(float deltatime) {

}

void GridSample::Render(float aspect) {
	p = glm::perspective(45.0f, aspect, 0.1f, 1000.0f);
	v = glm::lookAt(glm::vec3(0.0f, y, z), glm::vec3(0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
	PerFrameData gridPerFrameData = { v,p ,glm::vec4(0.0f,y,z,1.0f) };
	grid->Draw(gridPerFrameData);
}

void GridSample::OnGUI() {
	ImGui::Text("Grid");
	ImGui::Separator();
	ImGui::SliderFloat("Y", &y, 0.0, 100.0f);
	ImGui::SliderFloat("Z", &z, 0.0, 100.0f);
}

void GridSample::ShutDown() {
	
}
